﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/AdministratorSite.Master" Inherits="System.Web.Mvc.ViewPage<Cs2102BookingSystem.Models.ROOM>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Create Room
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server" EnableViewState="true">

    <script runat="server">
    public void printError(string error_for)
    {
        if(ViewData[error_for]!=null)
        {
            Response.Write(ViewData[error_for]);
        }
    }
    </script>
    <asp:Panel ID="Panel2" runat="server" Height="61px" 
        style="font-size: xx-large; font-weight: 700; font-family: Calibri">
        <b>Create Room</b></asp:Panel>
    
    <% using (Html.BeginForm("../AdminCreate/createRoom",
                             "",
                             FormMethod.Post,
                             new Dictionary<string, object> { { "enctype", "multipart/form-data" } }))
       {%>
        <%: Html.ValidationSummary(true) %>
        <fieldset>
        <legend>Room Information</legend>
        <table>
            <tr>
                <td colspan="5" style="color:Red"><% printError("ERROR"); %></td>
            </tr>
            <tr>
                <td style="color:Red">*</td>
                <td style="width: 150px" colspan="2"><label for="H_NAME">Hotel</label></td>
                <td>
                    <%: Html.DropDownListFor(model => model.H_NAME, 
                                            (SelectList)ViewData["hotel_names"],
                                            new Dictionary<string, object> { { "id", "H_NAME" }, 
                                                                             { "runat", "server" }, 
                                                                             { "AutoPostBack", "true" }, 
                                                                             { "onchange", "this.form.submit()" },
                                                                             { "Enabled", "false" } })
                    %>
                </td>
                <td style="color:Red"><% printError("H_NAME_ERROR"); %></td>
            </tr>
            <tr>
                <td style="color:Red">*</td>
                <td style="width: 150px" colspan="2"><label for="H_Country">Country</label></td>
                <td>
                    <%: Html.DropDownListFor(model => model.H_COUNTRY, 
                                            (SelectList)ViewData["country_names"],
                                             new Dictionary<string, object> { { "id", "H_Country" }, 
                                                                             { "runat", "server" }, 
                                                                             { "AutoPostBack", "true" }, 
                                                                             { "onchange", "this.form.submit()" } })
                    %>
                </td>
                <td style="color:Red"><% printError("H_COUNTRY_ERROR"); %></td>
            </tr>
            <tr>
                <td style="color:Red">*</td>
                <td style="width: 150px" colspan="2"><label for="H_BRANCHNAME">Branch</label></td>
                <td>
                    <%: Html.DropDownListFor(model => model.H_BRANCHNAME, 
                                            (SelectList)ViewData["branch_names"],
                                             new Dictionary<string, object> { { "id", "H_BRANCHNAME" }, 
                                                                             { "runat", "server" } })
                    %>
                </td>
                <td style="color:Red"><% printError("H_BRANCHNAME_ERROR"); %></td>
            </tr>
            <tr>
                <td style="color:Red">*</td>
                <td style="width: 150px" colspan="2"><label for="ROOMTYPE">Room Type</label></td>
                <td>
                    <%: Html.TextBoxFor(model => model.ROOMTYPE)%>
                </td>
                <td style="color:Red"><% printError("ROOMTYPE_ERROR"); %></td>
            </tr>
            <tr>
                <td style="color:Red">*</td>
                <td style="width: 150px" colspan="2"><label for="BEDTYPE">Bed Type</label></td>
                <td>
                    <%: Html.TextBoxFor(model => model.BEDTYPE)%>
                </td>
                <td style="color:Red"><% printError("BEDTYPE_ERROR"); %></td>
            </tr>
            <tr>
                <td style="color:Red">*</td>
                <td style="width: 150px" colspan="2"><label for="PRICE">Price</label></td>
                <td>
                    <%: Html.TextBoxFor(model => model.PRICE)%>
                </td>
                <td style="color:Red"><% printError("PRICE_ERROR"); %></td>
            </tr>
            <tr>
                <td style="color:Red"></td>
                <td style="width: 150px" colspan="2"><label for="file">Image</label></td>
                <td><input type="file" name="file" /></td>
                <td style="color:Red"><% printError("IMAGE_ERROR"); %></td>
            </tr>
            <tr>
                <td style="color:Red"></td>
                <td style="width: 150px" colspan="2"><label for="NOOFROOM">Number of Rooms</label></td>
                <td>
                    <%: Html.TextBoxFor(model => model.NOOFROOM)%>
                </td>
                <td style="color:Red"><% printError("NOOFROOM_ERROR"); %></td>
            </tr>
            <tr>
                <td style="color:Red"></td>
                <td style="width: 150px" colspan="2"><label for="DIRECTION">Direction</label></td>
                <td>
                    <%: Html.TextBoxFor(model => model.DIRECTION) %>
                </td>
                <td style="color:Red"><% printError("DIRECTION_ERROR"); %></td>
            </tr>
            <tr>
                <td style="color:Red"></td>
                <td style="width: 150px" colspan="2"><label for="DESCRIPTION">Description</label></td>
                <td>
                    <%: Html.TextBoxFor(model => model.DESCRIPTION )%>
                </td>
                <td style="color:Red"><% printError("DESCRIPTION_ERROR"); %></td>
            </tr>
            <tr style="height:50px">
                <td colspan="3" style="color:Red">* indicates required fields</td>
            </tr>
            <tr>
                <td colspan="4"><input type="submit" value="Create" name="submit1" /></td>
            </tr>
        </table>
        </fieldset>
    <% } %>
    <div>
        <%: Html.ActionLink("Back to List", "Index") %>
    </div>

</asp:Content>

